import request from '@/utils/request';

/**
 * 修改密码
 * POST /user/modifyPassword
 */
export async function modifyPassword(data: API.ModifyPasswordParams, options?: API.baseOption) {
  return request<{ success: boolean }>('/user/modifyPassword', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * 普通账号密码登录方式 普通账号密码登录方式
 * GET /user/${id}/detail
 */
export async function queryUserInfo(id: string, options?: API.baseOption) {
  return request<API.UserInfo>(`/user/${id}/detail`, {
    method: 'GET',
    ...(options || {}),
  });
}

/**
 * 修改密码
 * POST /bill/list
 */
export async function queryBillList(data: API.BasePagination, options?: API.baseOption) {
  return request<API.BasePaginationRes<API.BillItem>>('/bill/list', {
    method: 'GET',
    data,
    ...(options || {}),
  });
}

/**
 * 修改openAi key
 * POST /user/modifyKey
 */
export async function modifyOpenAiKey(data: string, options?: API.baseOption) {
  return request<{ success: boolean }>('/user/modifyKey', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * 查询用户列表
 *  /user/list
 */
export async function queryUserList(options?: API.baseOption | API.QueryUserListParam) {
  return request<API.UserList>('/user/list', {
    method: 'GET',
    ...(options || {}),
  });
}

/**
 * 修改用户状态
 * /user/statusToggle
 */
export async function statusToggle(data: API.StatusToggleParam, options?: API.baseOption) {
  return request<API.TResult<null>>('/user/statusToggle', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * 保存用户
 * /user/save
 */
export async function saveUser(data: API.SaveUserParam, options?: API.baseOption) {
  return request<API.TResult<null>>('/user/save', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}
